#! /usr/bin/env python
#coding=utf-8

import memcache

class MemCachePools:
    
    def __init__(self, host='', port=11211):
        if host == '':
            host = "localhost"
        self.mc = memcache.Client(['%s:%d'%(host, port)], debug=0)
    
    def mSet(self, key, val, extime=0):
        
        return self.mc.set(key=key, val=val, time=extime)
        
    def mGet(self, key):
        return self.mc.get(key)
    
    def mDel(self, key):
        self.mc.delete(key)
    
    def mDec(self, key, delta):
        self.mc.decr(key, delta)
        
    def mInc(self, key, delta):
        self.mc.incr(key, delta)
        
    def mFlashAll(self):
        self.mc.flush_all()
        

"""
m = MemCachePools()

m.mSet("kk", "value")
print m.mGet("kk")
"""